<%layout("/eova/layout/default_h.html",{'title' : 'Office'}){%>

<body class="gray-bg">
	
	<div class="container-div">
		<div class="row">
	
			<!-- <div class="col-sm-12 search-collapse">
				<form id="ordinary-form">
					<div class="select-list">
						<ul>
							<li>
								用户名称：<input type="text" name="userName"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="query()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div> -->
			
			<% if(object! != null){//可能未配置 %>
			<#query_h id="form_${object.id}" objectCode="${object.code}" object="${object}"  />
	 		<% } %>
	 		
	 		<div class="col-sm-12 select-table table-striped">
				<div class="bootstrap-table">


					<div class="fixed-table-toolbar">
						<div class="bs-bars pull-left">
							<div class="btn-group-sm"  role="group">
								<!-- <a class="btn btn-success"
									onclick="$.operate.add(false,null,null,null)"> <i
									class="fa fa-plus"></i> 新增
								</a> <a class="btn btn-primary single"
									onclick="$.operate.edit(false,null,null,null)"> <i
									class="fa fa-edit"></i> 修改
								</a> <a class="btn btn-danger multiple"
									onclick="$.operate.removeAll()"> <i class="fa fa-remove"></i>
									删除
								</a> -->
								
								 <%for(btn in btnList){
				  try{%>
					 <%include(btn.ui,{'menu': menu, 'object':object!, 'button': btn, 'gridId': 'grid','queryId':'queryForm'}){}%>
				  <%}catch(error){debug('按钮:'+btn.ui +' 加载失败。');%>
				  <script type="text/javascript">
				  
				  layui.use(['layer'], function(){ layer.alert("按钮 '${btn.name}' 未能加载,请联系管理员.", {icon: 2});});
				  </script>
				  <%}}%>
			  
	            <% debug(session.user!);debug(object!); // 仅超级管理员可见%>
        						<%if(session.user.isAdmin){%>
        						<%include("/eova/button/btn/quick_h.html",{'menu': menu, 'object':object!, 'queryId':'queryForm', 'parentId': 'grid'}){}%>
				<%}%>


							</div>
						</div>
						<div class="columns columns-right btn-group pull-right">
							<button class="btn btn-default btn-outline" type="button"
								name="showSearch" title="搜索">
								<i class="glyphicon glyphicon-search"></i>
							</button>
							<!-- <button class="btn btn-default btn-outline" type="button"
								name="refresh" title="刷新">
								<i class="glyphicon glyphicon-refresh icon-refresh"></i>
							</button> -->
						</div>
					</div>




					<div class="embed-responsive embed-responsive-16by9 fixed-table-container">
<!-- 				  <iframe  class="embed-responsive-item" src="/office/show/${para!}"></iframe> -->
					  <iframe id="show" class="embed-responsive-item" src="" allowtransparency="true" style="border: 0; width: 100%; height: 96%;" frameborder="0"></iframe>
					  <iframe id="print" style="height: 0;width: 0"></iframe>
					</div>
            
				</div>
			</div>
	 	
    </div>
</body>


<script type="text/javascript">
var showUrl = '/office/show/${menu.code}';
var downUrl = '/office/file/${menu.code}';
		function bb_download() {
			window.open(downUrl+'?'+$.getFormParasStr($("#form_${object.id!}")));
		}
		function bb_print() {
			var show = document.getElementById('show');
			var print = document.getElementById('print');
			
			// 保证打印内容按正常比例打印
			print.contentWindow.document.head.innerHTML = show.contentWindow.document.head.innerHTML
			print.contentWindow.document.body.innerHTML = show.contentWindow.document.body.innerHTML
			print.contentWindow.focus();
			print.contentWindow.print();
		}
		
		function refresh(){
			console.log('refresh');
			 $('iframe').attr('src',showUrl+'?'+$.getFormParasStr($("#form_${object.id!}")));
		}
		
		$(function(){
			//搜索表单显示隐藏
			$("button[name='showSearch']").click(function () {
				//console.log($('div.search-collapse'));
				
				 $(".search-collapse").slideToggle();
				
				
				
	        });
			
			//初始刷新下数据
			refresh();	
			
		});
		 
</script>
<script type="text/javascript" src="${STATIC!}/ui/js/template.js"></script>
<%}%>
